home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / telecomm / uniterm.zoo / unitest.pas < prev   
Pascal/Delphi Source File  |  1990-04-06  |  4KB  |  99 lines

  1. Program ShowParmBlock;
  2. {Stupid program to show how to use the $VARBLOCK UniTerm variable} 
  3.  
  4. Type 
  5.    {ParmBlock contains buffer addresses etc. to be passed on to other
  6.     processes}
  7.    ParmBlock = Record
  8.                   PBLength       : Integer;
  9.                   {Length of ParmBlock in bytes, handy as a version
  10.                    check}
  11.                   PBFlags        : Long_Integer; 
  12.                   {Not used yet}
  13.                   PBTextScreen   : Long_Integer; 
  14.                   {Address of text screen}
  15.                   PBGraphScreen  : Long_Integer; 
  16.                   {Address of graph screen, same as PBTextScreen 
  17.                    if not available}
  18.                   PBScreenBuffer : Long_Integer; 
  19.                   {Address of buffer for screen ops etc.}
  20.                   PBTransBuffer  : Long_Integer; 
  21.                   {Address of buffer used for the various file transfer
  22.                    protocols}
  23.                   PBTransSize    : Long_Integer;
  24.                   {Size of the transfer buffer (in bytes)}
  25.                   PBTransPtrAdr  : ^Long_Integer;
  26.                   {Address of the pointer to the current
  27.                    position in the buffer} 
  28.                   PBHistBuffer   : Long_Integer;
  29.                   {Address of the history buffer}
  30.                   PBHistSize     : Long_Integer;
  31.                   {Size of the history buffer}
  32.                   PBHistBotAdr   : ^Long_Integer;
  33.                   {Address of the pointer to the current bottom
  34.                    of the history buffer}
  35.                   PBHistPtrAdr   : ^Long_Integer;
  36.                   {Address of the pointer to the current position
  37.                    in the history buffer}
  38.                   PBClipSize     : Long_Integer;
  39.                   {Current max size of clipboard}
  40.                   PBClipRecAdr   : ^ClipType;
  41.                   {Pointer to clipboard record}
  42.                End;
  43.  
  44.   {* Clip Type *}
  45.   ClipBuffer = Packed Array[1..$400000] Of Char; {If anybody needs more...}
  46.   ClipBufferPtr = ^ClipBuffer;
  47.   ClipType = Packed Record
  48.                 Len : Long_Integer;
  49.                 Buffer : ClipBufferPtr;
  50.              End;
  51.  
  52. Var ComLine : String;
  53.     Block : Record {If you could only cast in Pascal...} 
  54.                Case Boolean Of {Yuck!}
  55.                   True : (Ptr : ^ParmBlock);
  56.                   False : (Long : Long_Integer);
  57.                End;
  58.     Ch : Char;
  59.     i : Integer;
  60.  
  61. Begin
  62.    Cmd_Getarg(1,ComLine); 
  63.    {Get first argument from commandline, DON'T DO IT LIKE THIS}
  64.    If ComLine <> '' Then Begin
  65.       ReadV(ComLine,Block.Long);
  66.       {Check that it is a valid address < this applications
  67.        basepage here!}
  68.       WriteLn('Address of Parameter Block: ',Block.Long:8:h);
  69.       {$P-,T-}
  70.       With Block.Ptr^ Do Begin
  71.          WriteLn('Length of parameter block:      ',PBLength:4);
  72.          {In a real application check that PBLength is >= what
  73.           you expect}
  74.          WriteLn('Flags:                      ',PBFlags:8:h); 
  75.          WriteLn('Text screen address:        ',PBTextScreen:8:h); 
  76.          WriteLn('Graphics screen adr:        ',PBGraphScreen:8:h); 
  77.          WriteLn('Screen buffer adr:          ',PBScreenBuffer:8:h); 
  78.          WriteLn('Transfer buffer adr:        ',PBTransBuffer :8:h); 
  79.          WriteLn('Transfer buffer size:       ',PBTransSize:8:h);
  80.          WriteLn('Current position:           ',PBTransPtrAdr^:8:h);
  81.          WriteLn('History buffer adr:         ',PBHistBuffer:8:h);
  82.          WriteLn('History buffer size:        ',PBHistSize:8:h);
  83.          WriteLn('Current history bottom:     ',PBHistBotAdr^:8:h);
  84.          WriteLn('Current hist. position:     ',PBHistPtrAdr^:8:h);
  85.          WriteLn('Current max. clipboard size:',PBClipSize:8:h);
  86.          WriteLn('Current size of clipboard contents:');
  87.          WriteLn('                            ',PBClipRecAdr^.Len:8:h);
  88.          WriteLn('Current clipboard contents:');
  89.          With PBClipRecAdr^ Do  
  90.             For i := 1 To Len Do 
  91.                If Buffer^[i] = Chr(13){CR} Then WriteLn
  92.                Else Write(Buffer^[i])    
  93.       End
  94.       {$P=,T=}
  95.    End;
  96.    Write('Press any key to continue...');
  97.    Read(Ch);
  98. End.
  99.